package cn.tedu.boot03.mapper;

import cn.tedu.boot03.entity.Product;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface ProductMapper {

    @Insert("INSERT INTO product VALUES(NULL,#{title},#{price},#{num})")
    int insert(Product product);

    @Select("SELECT id,title,price,num FROM product")
    List<Product> select();

    @Update("UPDATE product SET title=#{title},price=#{price},num=#{num} WHERE id=#{id}")
    int update(Product product);

    @Delete("DELETE FROM product WHERE id=#{id}")
    int deleteById(int id);

}
